package cn.huiyunche.base.service.interfaces;

import cn.huiyunche.base.service.form.SubCWGetForm;
import cn.huiyunche.base.service.vo.*;
import cn.huiyunche.tools.basic.exceptions.BusinessException;

import java.text.ParseException;
import java.util.List;
import java.util.Map;

/**
 * The interface Sub supplier service.
 *
 * @FileName: cn.huiyunche.service.base.interfaces
 * @Description: 分供方
 * @author: Aaron
 * @date: 2016 /12/6 下午2:07
 */
public interface DSubSupplierService {

    /**
     * Filter dw list list.
     *
     * @param form the form
     * @return the list
     */
    List<TmsQueueOrderVo> filterDWList(SubCWGetForm form) throws Exception;

    /**
     * Add long.
     *
     * @param form the form
     * @return the long
     */
    Long add(SubCWGetForm form) throws Exception;

    /**
     * Update.
     *
     * @param id        the id
     * @param fieldsMap the fields map
     */
    void update(Long id, Map<String, Object> fieldsMap);

    /**
     * Add queue.
     *
     * @param vos the vos
     */
    void addToSetOfRedis(List<TmsQueueOrderVo> vos);

    /**
     * Gets waiting list.
     *
     * @param page the page
     * @return the waiting list
     */
    Map<String, Object> getWaitingList(PageVo page) throws Exception;

    /**
     * Gets execution dw list.
     *
     * @param page the page
     * @return the execution dw list
     */
    Map<String, Object> getExecutionDWList(PageVo page) throws Exception;

    /**
     * Gets complete dw list.
     *
     * @param page the page
     * @return the complete dw list
     */
    Map<String, Object> getCompleteDWList(PageVo page) throws Exception;

    /**
     * Gets dw list by conditions.
     *
     * @param page          the page
     * @param waybillStatus the waybill status
     * @param paramsMap     the params map
     * @return the dw list by conditions
     */
    Map<String, Object> getDWListByConditions(PageVo page, List<Integer> waybillStatus, Map<String, Object> paramsMap) throws Exception;

    /**
     * 分供方 查询司机ID
     *
     * @param isContainHimself the is contain himself
     * @return sub user by user
     */
    List<Long> getSubUserByUser(Boolean isContainHimself) throws Exception;

    /**
     * Gets drivers by user.
     * 查询分供方下属司机
     *
     * @param page   the page
     * @param isFree the is free
     * @return the drivers by user
     */
    Map<String, Object> getDriversByUser(PageVo page, Boolean isFree) throws Exception;

    /**
     * Gets logistics by dw id.
     * 根据运单主键查询物流信息
     *
     * @param page       the page
     * @param dWaybillId the d waybill id
     * @return the logistics by dw id
     */
    Map<String, Object> getLogisticsByDWId(PageVo page, Long dWaybillId);

    /**
     * Specify driver.
     * 指派司机
     *
     * @param wid the wid 运单主键
     * @param uid the uid 司机主键
     */
    void specifyDriver(Long wid, Long uid) throws Exception;

    /**
     * Remove form set of redis.
     *
     * @param wid           the wid
     * @param currentUserId the current user id
     */
    void removeFormSetOfRedis(Long wid, Long currentUserId);

    /**
     * Gets routes.
     *
     * @return the routes
     */
    List<SupplierRouteVo> getRoutes() throws Exception;

    /**
     * 查询出车记录接口
     *
     * @param page the page
     * @return done by page
     */
    Map<String, Object> getDoneByPage(PageVo page);

    /**
     * 异常回单列表
     *
     * @param page the page
     * @return map map
     */
    Map<String, Object> selectAnomalyWaybill(PageVo page) throws Exception;

    /**
     * 添加司机
     *
     * @param tmsImportUserVo the tms import user vo
     * @param userVo          the user vo
     * @throws BusinessException the business exception
     * @throws ParseException    the parse exception
     */
    void addDriver(TmsImportUserVo tmsImportUserVo, UserVo userVo) throws BusinessException, ParseException;

    /**
     * 编辑司机
     *
     * @param tmsImportUserVo the tms import user vo
     * @throws BusinessException the business exception
     * @throws ParseException    the parse exception
     */
    void editDriver(TmsImportUserVo tmsImportUserVo) throws Exception;

    /**
     * 删除司机
     *
     * @param dUserId the d user id
     * @param sUserId the s user id
     * @throws BusinessException the business exception
     */
    void deleteDriver(String dUserId, String sUserId) throws Exception;

    /**
     * 查询运单价格明细
     *
     * @param waybillId the waybill id
     * @return list list
     */
    List<DWaybillPriceDetailVo> selectPriceById(Long waybillId);

    /**
     * Recover d waybill.
     * 回收分供方运单
     */
    void recoverDWaybill() throws Exception;

    /**
     * 查询运单详情
     *
     * @param id the id
     * @return by id
     */
    DWaybillDetailVo getById(long id) throws Exception;

}
